package com.moyq5.mvc.maker.test.bean.entity;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicUpdate;

import com.moyq5.mvc.maker.test.bean.embed.AgentAdminId;

/**
 * 代理商管理员
 * @author Moyq5
 * @date 2018年4月13日
 */
@Entity
@Table(name = "uc_agent_admin")
@DynamicUpdate
public class AgentAdmin implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -6456905938544806359L;
	
	/**
	 * 代理商管理员ID
	 */
	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "agentId", column = @Column(name = "agent_id", nullable = false, precision = 15, scale = 0)),
			@AttributeOverride(name = "adminId", column = @Column(name = "admin_id", nullable = false, precision = 15, scale = 0)) })
	private AgentAdminId id;
	/**
	 * 代理商
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "agent_id", nullable = false, insertable = false, updatable = false)
	private Agent agent;
	/**
	 * 管理员
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "admin_id", nullable = false, insertable = false, updatable = false)
	private SysAdmin admin;
	/**
	 * 微信公众号open_id
	 */
	@Column(name = "open_id", length = 30)
	private String openId;
	public AgentAdminId getId() {
		return id;
	}
	public void setId(AgentAdminId id) {
		this.id = id;
	}
	public Agent getAgent() {
		return agent;
	}
	public void setAgent(Agent agent) {
		this.agent = agent;
	}
	public SysAdmin getAdmin() {
		return admin;
	}
	public void setAdmin(SysAdmin admin) {
		this.admin = admin;
	}
	public String getOpenId() {
		return openId;
	}
	public void setOpenId(String openId) {
		this.openId = openId;
	}
	
}
